﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.DirectX.Direct3D;
using System.Threading;
using Microsoft.DirectX;
using MediaCenter.Controls;

namespace MediaCenter
{
    public partial class frm_Main : LCARS_Form
    {
        MediaCenter.Audio.AudioPlayback ap;

        public frm_Main()
        {
            InitializeComponent();
            ap = new MediaCenter.Audio.AudioPlayback();
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.ShowDialog();
            ap.openfile(ofd.FileName);
            this.lcarS_ProgressBar1.MaximalValue = ap.Lenght;
            this.lbl_Artist.Text = ap.get_Artist();
            this.lbl_titel.Text = ap.get_Titel();
            this.lbl_album.Text = ap.get_Album();
            this.lbl_year.Text = ap.get_Year();
            this.lbl_genre.Text = ap.get_Genre();
            this.lbl_length.Text = ap.TimeLength;
        }


        private void frm_Main_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Down)
            {

            }
        }

        private void frm_Main_Load(object sender, EventArgs e)
        {
            
        }

        private void btn_forward_Click(object sender, EventArgs e)
        {
            
        }

        private void btn_Back_Click(object sender, EventArgs e)
        {
            ap.JumpToStart();
        }

        private void btn_StartStop_Click(object sender, EventArgs e)
        {
            ap.Play();
        }

        private void btn_Pause_Click(object sender, EventArgs e)
        {
            ap.Stop();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            this.lcarS_ProgressBar1.Value = ap.Possition;
            this.lbl_possition.Text = ap.TimePossition;
        }

        private void frm_Main_Resize(object sender, EventArgs e)
        {
            this.Refresh();
        }

        private void hideMainArea()
        {
            this.pan_audio.Visible = false;
            this.pan_options.Visible = false;
        }

        private void btn_audio_Click(object sender, EventArgs e)
        {
            hideMainArea();
            pan_audio.Visible = true;
        }

        private void btn_optionen_Click(object sender, EventArgs e)
        {
            hideMainArea();
            pan_options.Visible = true;
        }
    }
}
